package com.ssm.crud.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.crud.bean.Employee;
import com.ssm.crud.bean.EmployeeExample;
import com.ssm.crud.bean.EmployeeExample.Criteria;
import com.ssm.crud.dao.EmployeeMapper;
import com.ssm.crud.service.EmployeeService;


public class EmployeeServiceImpl implements EmployeeService{

	@Autowired
	private EmployeeMapper employeeMapper;
	
	@Override
	public List<Employee> selectByExampleWithDept(EmployeeExample example) {
		// TODO Auto-generated method stub
		return employeeMapper.selectByExampleWithDept(example);
	}

	@Override
	public int deleteByExample(EmployeeExample example) {
		// TODO Auto-generated method stub
		return employeeMapper.deleteByExample(example);
	}

	@Override
	public int deleteByPrimaryKey(Integer empId) {
		// TODO Auto-generated method stub
		return employeeMapper.deleteByPrimaryKey(empId);
	}

	@Override
	public int insertSelective(Employee record) {
		// TODO Auto-generated method stub
		return employeeMapper.insertSelective(record);
	}

	@Override
	public int insert(Employee record) {
		// TODO Auto-generated method stub
		return employeeMapper.insert(record);
	}

	@Override
	public Employee selectByPrimaryKeyWithDept(Integer empId) {
		// TODO Auto-generated method stub
		Employee employee = employeeMapper.selectByPrimaryKeyWithDept(empId);
		return employee;
	}

	@Override
	public int updateByPrimaryKeySelective(Employee record) {
		// TODO Auto-generated method stub
		return employeeMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByExampleSelective(Employee record, EmployeeExample example) {
		// TODO Auto-generated method stub
		return employeeMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(Employee record, EmployeeExample example) {
		// TODO Auto-generated method stub
		return employeeMapper.updateByExample(record, example);
	}

	@Override
	public int updateByPrimaryKey(Employee record) {
		// TODO Auto-generated method stub
		return employeeMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public void deleteBatch(List<Integer> del_ids) {
		// TODO Auto-generated method stub
		//2
		EmployeeExample example = new EmployeeExample();
		Criteria criteria = example.createCriteria();
		criteria.andEmpIdIn(del_ids);
		employeeMapper.deleteByExample(example);
		
		
	}

}
